<!doctype html>

<html lang="en">

    <head>

      <meta charset="utf-8">

      <title>Elliphino's Menu</title>

      <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

      <script src="http://code.jquery.com/jquery-1.9.1.js"></script>

      <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

      <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">

        <link type="text/css" rel="stylesheet" href="../stylesheet.css">

      <script>

      $(function() {

        $( "#accordion" ).accordion({
            collapsible: true,
            active: true
        });
      });
         
	  
	  $("#contactform").on('submit', function(e){

		alert("not submited");
		return false;

		});
	  
      </script>
	  <style>
	  	   #banner {

            position: absolute;

            top: 0px;

            left: 0px;

            right: 0px;

            width: 100%;

            height: 175%;

            z-index: -1;

        }
	  </style>

    </head>

    <body>
	<!--<img id = "banner" src = "http://3rdbillion.net/wp-content/uploads/2014/01/de75da844f2d042aef2005036d5887342.jpg" alt = "Banner Image"/>-->
    <!--An example of an accordion layout with drop-down menus-->
    <!--CSS-->
		<style>
              .sandwichPics{
                    margin-left:80%;
              }
              .l-wrapper {
/*                    margin-top: 3%;*/
                    width: 42%;
                    margin-left: 8%;
                  float: left;
              }
			#list-wrapper {
				height: 160px;
/*                width: 33%;*/
                float:left;
                clear: right;
			  }
              #r-wrapper{
/*                    margin-top: 3%;*/
                    width: 42%;
                    margin-right: 8%;
                  float: right;
              }
              .button1{
                    margin-left:20%;
              }
			  .orderSummary{
                    color:#222;
				    font-weight: 900;
				    position:absolute;
                    float: right;
				    left:75%;
/*				    top:40%;*/
			  }
            .sandwich-header {
                font-family: Diplomata; 
                font-size: 1.7em;
            }
            .pop-sandwich {
                font-size: 1.5em;
            }
        </style>
	
		<!--Welcomes Guest or logged-in user-->
        <h1 class="title">Sandwiches Elliphino's</h1>
		<div>
                <form method="POST" action="">
                    <input name = "help" value ="Ayuda" type="submit" >
                    <?php
                    if(isset($_POST['help']))
                    {
                       $_SESSION['staffHelp']=1;
                        ?>
                    
                         <script type = 'text/javascript'> 
                            alert("Un empleado estara con usted en unos minutos.");
                        </script>
                        <?php
                    }
                    ?>
                </form>    
				<form method="POST" action="">
                    <input name = "manager" value ="LLamar al Gerente" type="submit" >
                    <?php
                    if(isset($_POST['manager']))
                    {
                      $_SESSION['managerHelp'] = 1;
                        ?>
                        <script type = 'text/javascript'> 
                            alert("Un Gerente estara con usted en unos minutos.");
                        </script>
                        <?php
                    }
                    ?>
                </form>   				
        </div>
		<?php
		include('esp_orderItem.php');
		ob_start();
		session_start();
		if(isset($_SESSION['promptForKids']) && isset($_SESSION['enterFieldOnce']))
            {
                if($_SESSION['promptForKids']==0 && $_SESSION['enterFieldOnce'] == 0)
                {
                   ?>
                  <form method="post" action="">
                  <h4>Cuantos ni&ntildeos tiene con usted??</h4> <input type="text" name = "numKids" value="" maxlength = 1><br>
                  <input type = "submit" name = "submit5" value = "Submit"></form>
                    <?php
             
                    $_SESSION['promptForKids']=1;
                }
                
            }
            if(isset($_POST['submit5']))
            {
                if(isset($_POST['numKids']))
                {
                    $_SESSION['numKids'] = $_POST['numKids'];
                    echo "<h2>Con la compra de " .  $_SESSION['numKids'] . " sandwiches, usted prodra obtener " .  $_SESSION['numKids'] . "                         Menus Infantiles GRATIS!!!</h2>";
                  
                    $_SESSION['enterFieldOnce'] = 1;
                }
            }
if (isset($_SESSION['email']))
{
  $name = $_SESSION['first_name']." ".$_SESSION['last_name'];
  echo"<h2 class=\"subtitle\">";
  echo"Bienvenido $name!";
  echo"</h2>";
}

else
{
  $name = "Invitado";
  echo"<h2 class=\"subtitle\">Bienvenido " . $name . "!" . "</h2>";
  //if you are a guest we need to start session, if you've logged in it has already been started from the previous page
}
?>
<div class="1-wrapper">
<?php
		//find out what the most popular sandwiches are for the previous day
		$username = 'root';
        $pw = 'password';
		$con = mysqli_connect ("localhost", $username, $pw, 'elliphinos');
		
		if (mysqli_connect_errno()) 
		{
             echo "Failed to connect to MySQL: " . mysqli_connect_error();
        }
		
		//set time to the central time zone
		if ( !date_default_timezone_set ( 'America/Chicago' ) )
		{
			echo "could not set time zone!";
		}
		
		$date = new DateTime();
		$dayOfMonth = date_format($date, 'd');//get the date of today
		$yesterday = $dayOfMonth;//get yesterday's date
		$yearAndMonth = date_format($date, 'Y-m');//year and month with a dash delimiter
		
		//build date string  s
		$yesterdaysDate = $yearAndMonth . '-' . $yesterday;
		
		//this if statement executes some special case stuff for when it is the first of the month and we need to roll back the date
		if ($yesterday == 0 ) 
		{
		
			$month = date_format($date, 'm');
			if ($month == 0) 
			{ //if it is january we need to flip things back to being in december
				$month = 12;
				$year = date_format($date, 'Y') - 1;
			}
			else 
			{
				$year = date_format($date, 'Y');
			}
			
			switch ($month) 
			{ //this switch statement changes the day based on how many days are in in the previous month
				case 1:
					$yesterday = 31;
					break;
				case 2:
					$yesterday = 28 ;
					break;
				case 3:
					$yesterday = 31;
					break;
				case 4:
					$yesterday = 30;
					break;
				case 5:
					$yesterday = 31;
					break;
				case 6:
					$yesterday = 30;
					break;
				case 7:
					$yesterday = 31;
					break;
				case 8:
					$yesterday = 31;
					break;
				case 9:
					$yesterday = 30;
					break;
				case 10:
					$yesterday = 31;
					break;
				case 11:
					$yesterday = 30;
					break;
				case 12:
					$yesterday = 31;
					break;
			}
			
			$month = date_format('m') - 1;
			$yesterdaysDate = $year . "-" . $month;
		}
		
		//start and end times for yesterday
		$yesterdayQueryTimeStart = $yesterdaysDate . " 00:00:01";
		$yesterdayQueryTimeEnd = $yesterdaysDate . " 23:59:59";
		
		$sandwichNames = array( 'Spencers Ham Sandwich', 'Turkey Sandwich', 'The Duncan', 'Shrimp Po Boy',
		'Nicos Spicy Chicken Sandwich', 'The Jonathon');
		$sandwichCounts = array(0,0,0,0,0,0);
		
		//count up the total sandwiches ordered yesterday for each sandwich type
		for ($i = 0; $i < 6; $i++)
		{
			$sql = "SELECT COUNT(*) AS total FROM orders WHERE sandwichType='$sandwichNames[$i]' AND
			(time BETWEEN '$yesterdayQueryTimeStart' AND '$yesterdayQueryTimeEnd')";
			$result = mysqli_query($con, $sql);
			$data = mysqli_fetch_assoc($result);
			$sandwichCounts[$i] = $data['total'];
		}
		
		//loop through array storing sandwich counts and find the most popular one
		//then find the second most popular one and then the third most popular one
		//output each one after finding it.
		?>
		
		<div id="list-wrapper">
			<h2 class="sandwich-header">Nuestros sandwiches mas populares son: </h2>
		
		<?php
		echo "<h2>" . "Nuestros sandwiches mas populares son: </h2>" . "</br>";//THIS NEEDS TO BE NICELY FORMATTED WITH HTML AND PRETTY CSS
		for ($i = 0; $i < 3; $i++)
		{
			$indexMostPopular = 0;//index in array of the most popular sandwich
			$totalMostPopular = 0;//number of orders of most popular sandwich
			
			for ($j = 0; $j < 6; $j++)
			{
				if ($sandwichCounts[$j] > $totalMostPopular)
				{
					$totalMostPopular = $sandwichCounts[$j];
					$indexMostPopular = $j;
					//make this small so that we don't output the most popular sandwich in the 2nd and 3rd places
					$sandwichCounts[$j] = -1;
				}
			}
			$indexMostPopular++;
			$i = $i + 1;//increment i so that the numbers that print out for the user don't start at 0
			
			//THIS NEEDS TO BE NICELY FORMATTED WITH HTML AND PRETTY CSS
			//print out sandwiches based on the index of the most popular one selected
			switch($indexMostPopular) 
			{
				case 1:
					echo  "<h3 class ='pop-sandwich'>$i.) El Spencer: Sandwich clasico de jamon</h3>";
					break;
				
				case 2:
					echo "<h3 class ='pop-sandwich'>$i.) Sandwich de pavo simple</h3>";
					break;
					
				case 3:
					echo "<h3 class ='pop-sandwich'>$i.) El Duncan</h3>";
					break;
				
				case 4:
					echo "<h3 class ='pop-sandwich'>$i.) Po' Boy de Camarones</h3>";
					break;
				
				case 5:
					echo  "<h3 class ='pop-sandwich'>$i.) El Nico: Sandwich de Pollo Picante</h3>";
					break;
					
				case 6:
					echo  "<h3 class ='pop-sandwich'>$i.) El Jonathan</h3>";
					break;
					
				//do we need a default? I dunno how switch statements work
				default:
					break;
			}
			
			$i = $i - 1;//change $i back so that it doesn't mess up the loop invariant
		}
		
		?>
		
	  </div>

    <div id="accordion">
      <h3>El Spencer: Sandwich clasico de jamon
     <!--Insert an Image of the Sandwich-->

     <!--<div class = "sandwichPics"><img height = 60 width = 80 src = "http://webberenergyblog.files.wordpress.com/2010/03/Ham_sandwich.jpg"></div>-->
      </h3>
    <form method="POST" action=''>

      <div>

<!--             -->
                <p>
                Pan
                    <br>
                    <select name = "breadType">
                        <option value = "Integral">Pan Integral</option>
                        <option value = "Blanco">Pan Blanco</option>
                        <option value = "Frances">Pan Frances</option>
                        <option value = "Arabe">Pan Arabe</option>
						<option value = "N/A">Ninguno</option>

                    </select>
                </p>
                <p>
                Carne
                    <br>
                    <select name = "meatType">
                        <option value = "Jamon">Jamon</option>
                        <option value = "Pavo">Pavo</option>
                        <option value = "Camarones">Camarones</option>
                        <option value = "Pollo">Pollo</option>
                        <option value = "Albondigas">Albondigas</option>
                        <option value = "Pastrami">Pastrami</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
				<p>
				Queso
                    <br>
					<select name = "cheese">
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "Pepper-Jack">Pepper-Jack</option>
						<option value = "N/A">Ninguno</option>
					</select>
				</p>
                <p>
                Verduras
                    <br>
                    <!--<select multiple = "multiple" vegetables = "vegType[]">-->
                    <select name = "vegType">
						<option value = "Lechuga">Lechuga</option>
                        <option value = "Tomates">Tomates</option>
                        <option value = "Cebollas">Cebollas</option>
                        <option value = "Pimenton Verde">Pimenton Verde</option>
                        <option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
                <p>
                Condimentos
                    <br>
                    <select name = "condimentType">
                        <option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Mayonesa">Mayonesa</option>
                        <option value = "Mostaza">Mostaza</option>
                        <option value = "Salsa de Tomate">Salsa de Tomate</option>
                        <option value = "Aji">Aji</option>
						<option value = "N/A">Ninguno</option>
                    </select>

                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
<!--             -->

	<!--Submit button for order form-->
    <input type="submit" name="button1"  value="Ordenar">
	<!--if button is pushed then get values of form items that user selected-->
    <?php
if (isset($_POST["button1"]))
{
  //store all values in Order array
  $SpencersJamon = new orderItem("El Spencer: Sandwich clasico de jamon", $_POST["breadType"],
    $_POST["meatType"], $_POST["cheese"], $_POST["vegType"], $_POST[
    "condimentType"], $_POST["drinkType"], $_POST["chipType"],
    $_POST["Dessert"]);

  echo"Total: "."$".$SpencersJamon->orderTotal();

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $SpencersJamon);
  }
  else
  {
    $_SESSION['orders'] = array($SpencersJamon);

  }

}

?>
        </form>
      </div>

      <h3>Sandwich de pavo simple</h3>
        <form method="POST" action=''>
     <div>


             
                <p>
                Pan
                    <br>
                    <select name = "breadType1">
                        <option value = "Blanco">Pan Blanco</option>
						<option value = "Integral">Pan Integral</option>
                        <option value = "Frances">Pan Frances</option>
                        <option value = "Arabe">Pan Arabe</option>
						<option value = "N/A">Ninguno</option>

                    </select>
                </p>
                <p>
                Carne
                    <br>
                    <select name = "meatType1">
						<option value = "Pavo">Pavo</option>
                        <option value = "Jamon">Jamon</option>
                        <option value = "Camarones">Camarones</option>
                        <option value = "Pollo">Pollo</option>
                        <option value = "Albondigas">Albondigas</option>
                        <option value = "Pastrami">Pastrami</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
				<p>
				Queso
                    <br>
					<select name = "cheese1">
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "Pepper-Jack">Pepper-Jack</option>
						<option value = "N/A">Ninguno</option>
					</select>
				</p>
                <p>
                Verduras
                    <br>
                    <!--<select multiple = "multiple" vegetables = "vegType[]">-->
                    <select name = "vegType1">
						<option value = "Lechuga">Lechuga</option>
                        <option value = "Tomates">Tomates</option>
                        <option value = "Cebollas">Cebollas</option>
                        <option value = "Pimenton Verde">Pimenton Verde</option>
                        <option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
                <p>
                Condimentos
                    <br>
                    <select name = "condimentType1">
                        <option value = "Mostaza">Mostaza</option>
						<option value = "Mayonesa">Mayonesa</option>
						<option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Salsa de Tomate">Salsa de Tomate</option>
                        <option value = "Aji">Aji</option>
						<option value = "N/A">Ninguno</option>
                    </select>

                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType1">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType1">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert1">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
<!--             -->

	<!--Submit button for order form-->
    <input type="submit" name="button2"  value="Ordenar">
	<!--if button is pushed then get values of form items that user selected-->
    <?php
if (isset($_POST["button2"]))
{
  $SimplePavo = new orderItem("Sandwich de pavo simple", $_POST["breadType1"],
    $_POST["meatType1"], $_POST["cheese1"], $_POST["vegType1"], $_POST[
    "condimentType1"], $_POST["drinkType1"], $_POST["chipType1"], $_POST[
    "Dessert1"]);

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $SimplePavo);

  }
  else
  {
    $_SESSION['orders'] = array($SimplePavo);

  }
  echo"Total: "."$".$SimplePavo->orderTotal();
}

?>
         </form>
         </div>
        

      <h3>El Duncan</h3>
      <form method="POST" action=''>
      <div>


             
                <p>
                Pan
                <br>
                    <select name = "breadType2">
                        <option value = "Integral">Pan Integral</option>
                        <option value = "Blanco">Pan Blanco</option>
                        <option value = "Frances">Pan Frances</option>
                        <option value = "Arabe">Pan Arabe</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                 
                </p>
                <p>
                Carne
                <br>
                    <select name = "meatType2">
                        <option value = "Albondigas">Albondigas</option>
                        <option value = "Jamon">Jamon</option>
                        <option value = "Pavo">Pavo</option>
                        <option value = "Camarones">Camarones</option>
                        <option value = "Pollo">Pollo</option>
						<option value = "Pastrami">Pastrami</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                 
                </p>
                <p>
                Verduras
                <br>
                    <select name = "vegType2">
						<option value = "N/A">Ninguno</option>
                        <option value = "Lechuga">Lechuga</option>
                        <option value = "Tomates">Tomates</option>
                        <option value = "Cebollas">Cebollas</option>
                        <option value = "Pimenton Verde">Pimenton Verde</option>
                        <option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
                    </select>
                  
                </p>
					<p>
				Queso
				<br>
					<select name = "cheese2">
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "Pepper-Jack">Pepper-Jack</option>
						<option value = "N/A">Ninguno</option>
                    </select>
					 
				</p>
                <p>
                Condimentos
                <br>
                    <select name = "condimentType2">
                        <option value = "Salsa de Tomate">Salsa de Tomate</option>
                        <option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Mayonesa">Mayonesa</option>
                        <option value = "Mostaza">Mostaza</option>
                        <option value = "Aji">Aji</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                 
                <br>
                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType2">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType2">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert2">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
      	<!--if button pushed then submit form-->
    <input type="submit" name="button3"  value="Ordenar">
    <?php
if (isset($_POST["button3"]))
{
  $theDuncan = new orderItem("El Duncan", $_POST["breadType2"], $_POST[
    "meatType2"], $_POST["cheese2"], $_POST["vegType2"], $_POST[
    "condimentType2"], $_POST["drinkType2"], $_POST["chipType2"], $_POST[
    "Dessert2"]);

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $theDuncan);
  }
  else
  {
    $_SESSION['orders'] = array($theDuncan);

  }
  echo"Total: "."$".$theDuncan->orderTotal();
}

?>
      </div>
            </form>
      <h3>Po' Boy de Camarones</h3>
        <form method = 'POST' action = ''>
        <div>


             
                <p>
                Pan
                <br>
                    <select name = "breadType">
                        <option value = "Arabe">Pan Arabe</option>
                        <option value = "Integral">Pan Integral</option>
						<option value = "Blanco">Pan Blanco</option>
						<option value = "Frances">Pan Frances</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                 
                </p>
                <p>
                Carne
                <br>
                    <select name = "meatType">
                        <option value = "Camarones">Camarones</option>
                        <option value = "Jamon">Jamon</option>
						<option value = "Pavo">Pavo</option>
                        <option value = "Pollo">Pollo</option>
						<option value = "Albondigas">Albondigas</option>
						<option value = "Pastrami">Pastrami</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                 
                </p>
				<p>
				Queso
				<br>
					<select name = "cheese">
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "Pepper-Jack">Pepper-Jack</option>
						<option value = "N/A">Ninguno</option>
					 </select>
				</p>
                <p>
                Verduras
                <br>
                    <select name = "vegType">
                        <option value = "Lechuga">Lechuga</option>
						<option value = "Tomates">Tomates</option>
						<option value = "Cebollas">Cebollas</option>
						<option value = "Pimenton Verde">Pimenton Verde</option>
						<option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                  
                </p>
                <p>
                Condimentos
                <br>
                    <select name = "condimentType">
                        <option value = "Mayonesa">Mayonesa</option>
                        <option value = "Mostaza">Mostaza</option>
						<option value = "Salsa de Tomate">Salsa de Tomate</option>
						<option value = "Aji">Aji</option>
						<option value = "Salsa Ranch">Salsa Ranch</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                 
                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
             <input type="submit" name="button4"  value="Ordenar">
        <?php
if (isset($_POST["button4"]))
{
  $CamaronesPoBoy = new orderItem("Po' Boy de Camarones", $_POST["breadType"], $_POST[
    "meatType"], $_POST["cheese"], $_POST["vegType"], $_POST["condimentType"],
    $_POST["drinkType"], $_POST["chipType"], $_POST["Dessert"]);

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $CamaronesPoBoy);
  }
  else
  {
    $_SESSION['orders'] = array($CamaronesPoBoy);

  }
  echo"Total: "."$".$CamaronesPoBoy->orderTotal();
}

?>
        
      </div>
        
      </form>


      <!--Code that goes on right side of accordion-->

       <h3>El Nico: Sandwich de Pollo Picante</h3>
      <form method = 'POST' action = ''>
      <div>


             
                <p>
                Pan
                    <br>
                    <select name = "breadType">
                        <option value = "Blanco">Pan Blanco</option>
						<option value = "Integral">Pan Integral</option>
                        <option value = "Frances">Pan Frances</option>
                        <option value = "Arabe">Pan Arabe</option>
						<option value = "N/A">Ninguno</option>

                    </select>
                </p>
                <p>
                Carne
                    <br>
                    <select name = "meatType">
                        <option value = "Pollo">Pollo</option>
						<option value = "Jamon">Jamon</option>
                        <option value = "Pavo">Pavo</option>
                        <option value = "Camarones">Camarones</option>
                        <option value = "Albondigas">Albondigas</option>
                        <option value = "Pastrami">Pastrami</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
				<p>
				Queso
                    <br>
					<select name = "cheese">
						<option value = "Pepper-Jack">Pepper-Jack</option>
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "N/A">Ninguno</option>
					</select>
				</p>
                <p>
                Verduras
                    <br>
                    <!--<select multiple = "multiple" vegetables = "vegType[]">-->
                    <select name = "vegType">
						<option value = "Tomates">Tomates</option>
						<option value = "Lechuga">Lechuga</option>
                        <option value = "Cebollas">Cebollas</option>
                        <option value = "Pimenton Verde">Pimenton Verde</option>
                        <option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
                <p>
                Condimentos
                    <br>
                    <select name = "condimentType">
                        <option value = "Aji">Aji</option>
						<option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Mayonesa">Mayonesa</option>
                        <option value = "Mostaza">Mostaza</option>
                        <option value = "Salsa de Tomate">Salsa de Tomate</option>
						<option value = "N/A">Ninguno</option>
                    </select>

                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
             
        <input type="submit" name="button5"  value="Ordenar">
          
        <?php
if (isset($_POST["button5"]))
{
  $NicosSandwich = new orderItem("El Nico: Sandwich de Pollo Picante", $_POST[
    "breadType"], $_POST["meatType"], $_POST["cheese"], $_POST["vegType"],
    $_POST["condimentType"], $_POST["drinkType"], $_POST["chipType"], $_POST[
    "Dessert"]);

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $NicosSandwich);
  }
  else
  {
    $_SESSION['orders'] = array($NicosSandwich);

  }
  echo"Total: "."$".$NicosSandwich->orderTotal();

}

?>
        
      </div>
        
      </form>
       <h3>El Jonathan</h3>
        <form method = 'POST' action = ''>
        <div>

                <p>
                Pan
                    <br>
                    <select name = "breadType">
                        <option value = "Frances">Pan Frances</option>
						<option value = "Integral">Pan Integral</option>
                        <option value = "Blanco">Pan Blanco</option>
                        <option value = "Arabe">Pan Arabe</option>
						<option value = "N/A">Ninguno</option>

                    </select>
                </p>
                <p>
                Carne
                    <br>
                    <select name = "meatType">
                        <option value = "Pavo">Pavo</option>
						<option value = "Jamon">Jamon</option>
                        <option value = "Camarones">Camarones</option>
                        <option value = "Pollo">Pollo</option>
                        <option value = "Albondigas">Albondigas</option>
                        <option value = "Pastrami">Pastrami</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
				<p>
				Queso
                    <br>
					<select name = "cheese">
						<option value = "Americano">Americano</option>
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Pepper-Jack">Pepper-Jack</option>
						<option value = "N/A">Ninguno</option>
					</select>
				</p>
                <p>
                Verduras
                    <br>
                    <!--<select multiple = "multiple" vegetables = "vegType[]">-->
                    <select name = "vegType">
						<option value = "Pimenton Verde">Pimenton Verde</option>
						<option value = "Lechuga">Lechuga</option>
                        <option value = "Tomates">Tomates</option>
                        <option value = "Cebollas">Cebollas</option>
                        <option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
                <p>
                Condimentos
                    <br>
                    <select name = "condimentType">
                        <option value = "Mayonesa">Mayonesa</option>
						<option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Mostaza">Mostaza</option>
                        <option value = "Salsa de Tomate">Salsa de Tomate</option>
                        <option value = "Aji">Aji</option>
						<option value = "N/A">Ninguno</option>
                    </select>

                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
              <input type="submit" name="button6"  value="Ordenar">
          
        <?php
if (isset($_POST["button6"]))
{
  $theJonathon = new orderItem("El Jonathan", $_POST["breadType"], $_POST[
    "meatType"], $_POST["cheese"], $_POST["vegType"], $_POST["condimentType"],
    $_POST["drinkType"], $_POST["chipType"], $_POST["Dessert"]);

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $theJonathon);
  }
  else
  {
    $_SESSION['orders'] = array($theJonathon);

  }
  echo"Total: "."$".$theJonathon->orderTotal();
}

?>
        
      </div>
        
      </form>

        <h3>Sandwich hecho a la orden</h3>

        <form method = 'POST' action = ''>
        <div>


             
                <p>
                Pan
                    <br>
                    <select name = "breadType">
                        <option value = "N/A">Ninguno</option>
						<option value = "Integral">Pan Integral</option>
                        <option value = "Blanco">Pan Blanco</option>
                        <option value = "Frances">Pan Frances</option>
                        <option value = "Arabe">Pan Arabe</option>
						

                    </select>
                </p>
                <p>
                Carne
                    <br>
                    <select name = "meatType">
                        <option value = "N/A">Ninguno</option>
						<option value = "Jamon">Jamon</option>
                        <option value = "Pavo">Pavo</option>
                        <option value = "Camarones">Camarones</option>
                        <option value = "Pollo">Pollo</option>
                        <option value = "Albondigas">Albondigas</option>
                        <option value = "Pastrami">Pastrami</option>
						
                    </select>
                </p>
				<p>
				Queso
                    <br>
					<select name = "cheese">
						<option value = "N/A">Ninguno</option>
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "Pepper-Jack">Pepper-Jack</option>
						
					</select>
				</p>
                <p>
                Verduras
                    <br>
                    <!--<select multiple = "multiple" vegetables = "vegType[]">-->
                    <select name = "vegType">
						<option value = "N/A">Ninguno</option>
						<option value = "Lechuga">Lechuga</option>
                        <option value = "Tomates">Tomates</option>
                        <option value = "Cebollas">Cebollas</option>
                        <option value = "Pimenton Verde">Pimenton Verde</option>
                        <option value = "Aceitunas Negras">Aceitunas Negras</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
                    </select>
                </p>
                <p>
                Condimentos
                    <br>
                    <select name = "condimentType">
                        <option value = "N/A">Ninguno</option>
						<option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Mayonesa">Mayonesa</option>
                        <option value = "Mostaza">Mostaza</option>
                        <option value = "Salsa de Tomate">Salsa de Tomate</option>
                        <option value = "Aji">Aji</option>
						
                    </select>

                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
             
        <input type="submit" name="button7"  value="Ordenar">
          
        <?php
if (isset($_POST["button7"]))
{
  $Custom = new orderItem("Sandwich hecho a la orden", $_POST["breadType"], $_POST[
    "meatType"], $_POST["cheese"], $_POST["vegType"], $_POST["condimentType"],
    $_POST["drinkType"], $_POST["chipType"], $_POST["Dessert"]);

  if (isset($_SESSION['orders']))
  {
    array_push($_SESSION['orders'], $Custom);
  }
  else
  {
    $_SESSION['orders'] = array($Custom);

  }
  echo"Total: "."$".$Custom->orderTotal();
}

?>
        
      </div>
        
      </form>
      <h3>Sandwich Misterioso</h3>
      <form method = "POST" action = "">
	  <div> 
	  
	  <?php
		//Choose random bread
		switch(rand(1,4)){
		case 1:
			$rand_bread = "Blanco";
		break;
		case 2:
			$rand_bread = "Integral";
		break;
		case 3:
			$rand_bread = "Frances";
		break;
		case 4:
			$rand_bread = "Arabe";
		break;
		default:
			$rand_bread = "N/A";
		break;
		}
		//Choose random meat
		switch(rand(1,6)){
		case 1:
			$rand_meat = "Jamon";
		break;
		case 2:
			$rand_meat = "Pavo";
		break;
		case 3:
			$rand_meat = "Camarones";
		break;
		case 4:
			$rand_meat = "Pollo";
		break;
		case 5:
			$rand_meat = "Albondigas";
		break;
		case 6:
			$rand_meat = "Pastrami";
		break;
		default:
			$rand_meat = "N/A";
		break;
		}
		//Choose random cheese
		switch(rand(1,3)){
		case 1:
			$rand_cheese = "Americano";
		break;
		case 2:
			$rand_cheese = "Pepper-Jack";
		break;
		case 3:
			$rand_cheese = "Mozzarella";
		break;
		default:
			$rand_cheese = "N/A";
		break;
		}
		//Choose random veggie
		switch(rand(1,6)){
		case 1:
			$rand_veggies = "Lechuga";
		break;
		case 2:
			$rand_veggies = "Tomates";
		break;
		case 3:
			$rand_veggies = "Cebollas";
		break;
		case 4:
			$rand_veggies = "Pimenton Verde";
		break;
		case 5:
			$rand_veggies = "Aceitunas Negras";
		break;
		case 6:
			$rand_veggies = "Aguacate";
		break;
		default:
			$rand_veggies = "N/A";
		break;
		}
		//Choose random sauce
		switch(rand(1,5)){
		case 1:
			$rand_sauce = "Salsa Ranch";
		break;
		case 2:
			$rand_sauce = "Mayonesa";
		break;
		case 3:
			$rand_sauce = "Mostaza";
		break;
		case 4:
			$rand_sauce = "Salsa de Tomate";
		break;
		case 5:
			$rand_sauce = "Aji";
		break;
		default:
			$rand_sauce = "N/A";
		break;
		}
		echo "<h3>" . "Tu Sandwich Misterioso es:" . "</h3>" . "</br>";
		echo "Pan: " . $rand_bread . "</br>";
        echo "Carne: " . $rand_meat . "</br>";
        echo "Queso: " . $rand_cheese . "</br>";
        echo "Verduras: " . $rand_veggies . "</br>";
        echo "Condimentos: " . $rand_sauce . "</br>";
		?>
		<p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
		<input type="submit" name="button8"  value="Ordenar">
		<h4>(15% de descuento)</h4>
		<?php
if (isset($_POST["button8"]))
{
  $Random = new orderItem("Sandwich Misterioso", $rand_bread, $rand_meat, $rand_cheese, $rand_veggies, $rand_sauce, $_POST["drinkType"], $_POST["chipType"], $_POST["Dessert"]);
		if (isset($_SESSION['orders']))
			{
			array_push($_SESSION['orders'], $Random);
			}
		else
			{
			$_SESSION['orders'] = array($Random);
			}	
  echo"Total: "."$".$Random->orderTotal();
}
?>
	  </div>
	  </form>
	  
      <h3>Sandwich del Dia</h3>
      <form method = "POST" action = "">
	  <div> 
	  
	  <?php
		//Find the day
		$day = date("l");
		switch($day){
		case "Monday":
			$day = "Lunes";
			$otd_name = "El Spencer: Sandwich clasico de jamon";
			$otd_bread = "Integral";
			$otd_meat = "Jamon";
			$otd_cheese = "Mozzarella";
			$otd_veggies = "Lechuga";
			$otd_sauce = "Salsa Ranch";
		break;
		case "Tuesday":
			$day = "Martes";
			$otd_name = "Sandwich de pavo simple";
			$otd_bread = "Blanco";
			$otd_meat = "Pavo";
			$otd_cheese = "Mozzarella";
			$otd_veggies = "Lechuga";
			$otd_sauce = "Mostaza";
		break;
		case "Wednesday":
			$day = "Miercoles";
			$otd_name = "El Duncan";
			$otd_bread = "Integral";
			$otd_meat = "Albondigas";
			$otd_cheese = "Mozzarella";
			$otd_veggies = "N/A";
			$otd_sauce = "Salsa de Tomate";
		break;
		case "Thursday":
			$day = "Jueves";
			$otd_name = "Po' Boy de Camarones";
			$otd_bread = "Arabe";
			$otd_meat = "Camarones";
			$otd_cheese = "Mozzarella";
			$otd_veggies = "Lechuga";
			$otd_sauce = "Mayonesa";
		break;
		case "Friday":
			$day = "Viernes";
			$otd_name = "El Nico: Sandwich de Pollo Picante";
			$otd_bread = "Blanco";
			$otd_meat = "Pollo";
			$otd_cheese = "Pepper-Jack";
			$otd_veggies = "Tomates";
			$otd_sauce = "Aji";
		break;
		case "Saturday":
			$day = "Sabado";
			$otd_name = "El Jonathan";
			$otd_bread = "Frances";
			$otd_meat = "Pavo";
			$otd_cheese = "Americano";
			$otd_veggies = "Pimenton Verde";
			$otd_sauce = "Mayonesa";
		break;
		case "Sunday":
			$day = "Domingo";
			$otd_name = "El especial de Domingo";
			$otd_bread = "Integral";
			$otd_meat = "Pavo";
			$otd_cheese = "Pepper-Jack";
			$otd_veggies = "Pimenton Verde";
			$otd_sauce = "Aji";
		break;
		}
		echo "<h3>" . "El sandwich del dia, hoy " . $day . ", es: " . $otd_name . "</h3>" . "</br>";
		echo "Pan: " . $otd_bread . "</br>";
        echo "Carne: " . $otd_meat . "</br>";
        echo "Queso: " . $otd_cheese . "</br>";
        echo "Verduras: " . $otd_veggies . "</br>";
        echo "Condimentos: " . $otd_sauce . "</br>";
		?>
		<p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                        <option value = "Mediana">Mediana</option>
                        <option value = "Grande">Grande</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
		<input type="submit" name="button9"  value="Ordenar">
		<h4>(15% de descuento)</h4>
		<?php
if (isset($_POST["button9"]))
{
	$OfTheDay = new orderItem("Sandwich del Dia", $otd_bread, $otd_meat, $otd_cheese, $otd_veggies, $otd_sauce,
		$_POST["drinkType"], $_POST["chipType"], $_POST["Dessert"]);
		if (isset($_SESSION['orders']))
			{
			array_push($_SESSION['orders'], $OfTheDay);
			}
		else
			{
			$_SESSION['orders'] = array($OfTheDay);
			}	
		echo"Total: "."$".$OfTheDay->orderTotal();
}
?>
	  </div>
	  </form>
	  <h3>Menu Infantil</h3> 

        <form method = 'POST' action = ''>
        <div>


             
                <p>
					Pan
                    <br>
                    <select name = "breadType">
						<option value = "Integral">Pan Integral</option>
                        <option value = "Blanco">Pan Blanco</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
                <p>
                Carne
                    <br>
                    <select name = "meatType">
						<option value = "Jamon">Jamon</option>
                        <option value = "Pavo">Pavo</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
				<p>
				Queso
                    <br>
					<select name = "cheese">
						
						<option value = "Mozzarella">Mozzarella</option>
						<option value = "Americano">Americano</option>
						<option value = "N/A">Ninguno</option>
						
					</select>
				</p>
                <p>
                Verduras
                    <br>
                    <select name = "vegType">
						
						<option value = "Lechuga">Lechuga</option>
                        <option value = "Tomates">Tomates</option>
						<option value = "Aguacate">Aguacate (+$1)</option>
						<option value = "N/A">Ninguno</option>
						
                    </select>
                  
                </p>
                <p>
                Condimentos
                    <br>
                    <select name = "condimentType">
						<option value = "Salsa Ranch">Salsa Ranch</option>
                        <option value = "Mayonesa">Mayonesa</option>
                        <option value = "Mostaza">Mostaza</option>
						<option value = "N/A">Ninguno</option>
                    </select>
                </p>
                <p>
                Bebida
                    <br>
                    <select name = "drinkType">
                        <option value = "N/A">Ninguna</option>
                        <option value = "Peque&ntildea">Peque&ntildea</option>
                    </select>
                </p>
                <p>
                Papas Fritas
                    <br>
                        <select name = "chipType">
                            <option value = "N/A">Ninguna</option>
                            <option value = "Sabor Natural">Sabor Natural</option>
                            <option value = "Doritos">Doritos</option>
                            <option value = "Tortillas">Tortillas</option>
                            <option value = "Sabor Barbeque">Sabor Barbeque</option>
                            <option value = "Sabor Crema y Cebollas">Sabor Crema y Cebollas</option>
                        </select>
                    </p>
                    <p>
                    Postre
                        <br>
                            <select name = "Dessert">
                                <option value = "N/A">Ninguno</option>
                                <option value = "Galleta">Galleta</option>
                                <option value = "Brownie">Brownie</option>
                                <option value = "Helado de Vainilla">Helado de Vainilla</option>
                            </select>
                        </p>
                    </select>
                </p>
        
        <input type="submit" name="button10"  value="Submit Order">
        <?php
        if (isset($_POST["button10"]))//if they submit the order
        { //pass selected values into constructor for onject OfTheDay
            if(  $_SESSION['numEntrees'] < $_SESSION['numKids'] &&   $_SESSION['numEntrees']>0 )
            {
            
                $freeKidsMeal = new orderItem("Free Kid's Meal", $_POST['breadType'], $_POST['meatType'], $_POST['cheese'], $_POST['vegType'],$_POST['condimentType'], $_POST['drinkType'], $_POST['chipType'], $_POST['Dessert']);
                if (isset($_SESSION['orders']))
			     {
			         array_push($_SESSION['orders'], $freeKidsMeal);
			     }
		          else
			     {
			         $_SESSION['orders'] = array($freeKidsMeal);
			     }	
		          echo"Total: "."$".$freeKidsMeal->orderTotal();
                
            
                $_SESSION['numEntrees']--;
            }
            
            else if( $_SESSION['numKids'] <= $_SESSION['numEntrees'] && $_SESSION['numKids']>0)
            {
                $freeKidsMeal = new orderItem("Menu Infantil GRATIS!", $_POST['breadType'], $_POST['meatType'], $_POST['cheese'], $_POST['vegType'],$_POST['condimentType'], $_POST['drinkType'], $_POST['chipType'], $_POST['Dessert']);
                if (isset($_SESSION['orders']))
			     {
			          array_push($_SESSION['orders'], $freeKidsMeal);
			     }
		          else
			     {
			             $_SESSION['orders'] = array($freeKidsMeal);
			     }	
		          echo"Total: "."$".$freeKidsMeal->orderTotal();
                
            
                $_SESSION['numKids']--;
            }
            else
            {
	          $kidsMeal = new orderItem("Menu Infantil", $_POST['breadType'], $_POST['meatType'], $_POST['cheese'], $_POST['vegType'],
              $_POST['condimentType'], $_POST['drinkType'], $_POST['chipType'], $_POST['Dessert']);
		      if (isset($_SESSION['orders']))
			  {
			     array_push($_SESSION['orders'], $kidsMeal);
			  }
		      else
			  {
			     $_SESSION['orders'] = array($kidsMeal);
			  }	
		      echo"Total: "."$".$kidsMeal->orderTotal();
            }
        }
        ?>
        </div>
        </form>
    
    </div>
    </form>

<?php
//----------------------------Sandwich Roullette-----------------------------

	
if(isset($_SESSION['email']) && $_SESSION['flag'] == 0){
        $prize = rand(1,100); 
		if($price % 50 == 0){
			$price = "Has ganado un Helado de Vainilla GRATIS!";
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "Helado de Vainilla");
			$win = TRUE;
		}
		else if($price % 25 == 0){
			$price = "Has ganado un Brownie GRATIS!";
			$win = TRUE;
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "Brownie");
		}
		else if($price % 20 == 0){
			$price = "Has ganado una Bebida Grande GRATIS!";
			$win = TRUE;
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "Grande", "N/A", "N/A");
		}
		else if($price % 10 == 0){
			$price = "Has ganado una Galleta GRATIS!";
			$win = TRUE;
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "Galleta");
		}
		else if($price % 5 == 0){
			$price = "Has ganado una Bebida Mediana GRATIS!";
			$win = TRUE;
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "Mediana", "N/A", "N/A");
		}
		else if($price % 4 == 0){
			$price = "Has ganado unas Papas Fritas GRATIS!";
			$win = TRUE;
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "Sabor Natural", "N/A");
		}
		else if($price % 2 == 0){
			$price = "Has ganado una Bebida Peque&ntildea GRATIS!";
			$win = TRUE;
			$FREE = new orderItem("Premio Gratis", "N/A", "N/A", "N/A", "N/A", "N/A", "Peque&ntildea", "N/A", "N/A");
		}
		else{
			$price = "Lo sentimos, no has ganado. Intentalo de neuvo en tu proxima visita.";
			$win = FALSE;
		}
		?>
          <script type = 'text/javascript'>
            //<!--
            $(window).load(function() {
                 var prize = "<?php echo $prize;?>";
                alert(prize);
            });
            //-->
          </script>
		<?php
		//if (isset($_POST["button10"]))
		//{
		//echo "<h4>" . $prize . "</h4>" . "</br>";
		if($win){
			if (isset($_SESSION['orders']))
				{
				array_push($_SESSION['orders'], $FREE);
				}
			else
				{
				$_SESSION['orders'] = array($FREE);
				}	
		}
        $_SESSION['flag'] = 1;
      }
		?>
		</div>
<!--needs CSS! Andrew or Jonathon-->
<div id="r-wrapper">
    <div id="sum-header">
        <h2 id = "summaryHeader">Resumen de la Orden</h2>
    </div>
    <div id="orderSummary">
<!--List Items, prices, and total-->
	<?php
//create function for order summary. Is called after delete button is pushed. Will print new array with new TOTAL
function orderSummary()
{
  $i = 0; //counter for order summary
  $counter = 1;

  //$j=0;
  $_SESSION['orderTotal'] = 0;
  //set TOTAl = 0, if item is deleted from array foreach will not add its cost to orderTotal
  if (isset($_SESSION['orders']))
  {
    foreach($_SESSION['orders'] as $anOrder)
    {
      $_SESSION['orderTotal'] += $anOrder->total;

      //$i++;
      echo "<h3 class=\"lineHeader\">" . $counter . ". " .  $anOrder->sandwichType . "</h3>";
      echo "<p class=\"lineOrder\">";
      echo "<strong>Pan: </strong>" . $anOrder->bread . "</br>" . "<strong>Carne: </strong>" . $anOrder->meat  . "</br> " . "<strong>Queso: </strong>" . $anOrder->cheese;
      echo  "</br>" .  "<strong>Verduras: </strong>" . $anOrder->veggies . "</br>" . "<strong>Condimentos: </strong>" . $anOrder->condiments;
      echo  "</br>" . "<strong>Bebida: </strong>" . $anOrder->drink . "</br>" . "<strong>Papas Fritas: </strong>" . $anOrder->chips;
      echo  "</br>" . "<strong>Postre: </strong>" .  $anOrder->dessert;
      echo "</p>";
	  if($anOrder->bread!="Empty"&&$anOrder->drink!="Empty")
                        {
                                echo "<p class=\"lineOrder\"><strong>Disfruta de nuestro descuento de $1 por la compra de tu combo con bebida!</strong></p>";
                            
                        }
                if($anOrder->bread!="Empty"&&$anOrder->meat!="Empty")
                {
                    $_SESSION['numEntrees']++;
                
                }
	  $cost = sprintf ("%.2f", $anOrder->total);
      echo "<h4 class=\"lineCost\">" . "</br>" ."Costo: " . "$" . $cost . "</h4>";
      $counter++;


?>
            <form method="POST" action=''>
                <!--must use $i to get correct delete button-->
            <input type="submit" name="<?php echo $i; ?>"  value="Eliminar">
          
        <?php
$i++;

}

}

//prints out TOTAL of all orders
$final_total = sprintf ("%.2f", $_SESSION['orderTotal']);
echo "<h2 style = \"color:#66FF00\">" . "TOTAL: " . "$" . $final_total . "</h2>";
}

?>
               
                    <?php
if(isset($_SESSION['orders']))
{
for ($j = 0; $j < sizeof($_SESSION['orders']); $j++)
//loops counter $j through sizeof orders array
{
  if (isset($_POST["$j"]))
  //if delete button was pushed on $j item then do the following:
  {
    //subtract value of item being deleted from total
    $_SESSION['orderTotal'] = $_SESSION['orderTotal'] - $_SESSION['orders'][$j]
      ->total;
    //delete current index in array
    unset($_SESSION['orders'][$j]);
    //re index array after deletion
    $_SESSION['orders'] = array_values($_SESSION['orders']);

  }

}
}
?>
<form method = "POST" action = ''>
            <input type = "submit" name = "checkout" value="Iniciar Compra">
            <?php
                if(isset($_POST['checkout']))
                {
                    if($_SESSION['orderTotal'] > 0)
                    {
                        $flag = NULL;
                        header("Location: esp_checkOut.php"); //if greater than 0, redirect to checkOut page
                    }
                    else
                        echo "Tu total debe ser mayor a $0. Intentalo de nuevo."; //if = to 0 then do no redirect
                }
            ?>
        </form>
<?php
orderSummary();
ob_flush();
?>
		<a href="esp_login.html" id="back">Atras</a>
    </body>
</html>
